package com.wwt.blog.controller;

import com.wwt.blog.service.CategoryService;
import com.wwt.blog.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/categorys")
public class CategoryController {
    @Resource
    CategoryService categoryService;
    @GetMapping()
    public Result getCategorys() {
       return categoryService.finfAllCateforys();
    }
    @GetMapping("/detail")
    public Result getCategoryDetail(){
        return categoryService.finfAllCateforys();
    }
    //根据分类ID查询细节
    @GetMapping("detail/{id}")
    public Result getCategoriseDetailBuId(@PathVariable("id") Integer id){

        return Result.result_success(categoryService.getCategory(id));
    }

}
